{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Sobel算子、Scharr算子与Laplacian算子"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 1. Sobel算子"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "① Sobel算子函数：cv2.Sobel(src, ddepth, dx, dy, ksize)，返回值为Sobel算子处理后的图像。\n",
    "\n",
    " - ddepth：图像的深度\n",
    " - dx 和 dy 分别表示水平和竖直方向\n",
    " - ksize 是 Sobel 算子的大小\n",
    " \n",
    "② 靠近最近点的左右和上下的权重最高，所以为±2。"
   ]
  },
  {
   "attachments": {
    "image.png": {
     "image/png": "iVBORw0KGgoAAAANSUhEUgAAA1EAAACHCAIAAAB4aERSAAAgAElEQVR4nO3de1xT9f848Pc5GzfTNvGSFjBvqZ+EYV4qBaaCihfwkpcS8ZqXNNJMU7moKBqmmaVIXqqPSKmZmQZqIiqwvICkDkxTsmRGJngZXoBt5/L74/39nN/axhhj7JzN1/MPH8ftsL13Lu/zet8JlmURAAAAAABwaSTfCQAAAAAAAI0OYj4AAAAAANcHMR8AAAAAgOuDmA8AAAAAwPVBzAcAAAAA4Pog5gMAAAAAcH0Q8wEAAAAAuD4x3wkQLoqiTpw4IRKJatuBpumBAwda2AG4qmPHjpEkSRBEbTvQNB0eHu7IJAHg7Giazs7OtpzlhoWFicXw2AI2suYaCw0NdXNzc2SqHImAOZlrQ1FUnSeeoiiI+Z5CWVlZlkO6+Pj41atXOyw9ALgAmqbrjOf0ej3EfMBmuNiQm5trYR+dTufCMR+07QJgfxaqAAEAAAiWa+feUGCqW3Bw8LJly0yvA4qieEkP4B3DMMeOHTN7SQwbNoyXJAHgMhQKRXx8vOn9RdM0L+kBrmTJkiXx8fFGL7Ism5OTk5yczEuSHAlivrqRJDlo0CAhxP5PnjzR6XTNmzfnMQ0syzIMwzAMQogkScvd2pwOTdOVlZXPPvus5fajIUOGmH1dr9c3TroAeLoMHDiQJPl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VawqFgqZpu3wmjgCs/DQuz69NUFAQL88CI9bnchRFBQUFWf5RCCGdTueAZFvGMExISEhCQoKVR9i+z0eGYRISEvAf6vX6BvwOoYN6PuESiUSPHj3y8PDgSioURXGj9ymKcnCDr7u7+5YtW0aMGJGenv7zzz8jhPz9/ZOTk8PDw523VXfZsmXLly83PKqG8yPU1NTA7M0APCVIknz06JG7uzvXNdkoy3W6Xh8kSdY5Tw3DMM5YGSa056OzgOeZcOGmBMNXDOMPXmIRkiSHDh0aHh6OswmCIJx93IaXl5fhf42OqtHxBwC4MJIkhZblNhBBEK46HakAn49OAY4LqDeSJAUb6tE0PWzYMH9/f74TAgDgX+fOnVu0aMEwjGCzLBvQND18+PBu3brxnRB7Yll21KhRLVq0YP89ygTYF8R8dWNZNjs72/QqpChq0KBBztus6ZI8PT2///77xl62+KeffjI7cajLjPUDgEcsy5pdIZem6bCwsHpV4UycOJFhGBer9fH09Pzuu++M2iicHUmS8+bNQ428IghN08ePHze9HliWdbqGe9u41J3QSJRKZW2DUuEZL0CNHfAhhEiSdNJxygAIn4Ust85hFkZEIpFLFstdLODDHBOar1271uyCUk8J16nuBgAAAABoCPbfa025GKjns+To0aMWyohQyffUYhjm2LFjFjqdwLUBgA2OHDliobLnKWl9A41qyZIl8fHxtb3r8teY8fKpAAAAAADA9UDbLgAAAACA64OYDwAAAADA9UHMBwAAAADg+iDmAwAAAABwfRDzAQAAAAC4Poj5AAAAAABc3/8D1iVFOto5y/kAAAAASUVORK5CYII="
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![image.png](attachment:image.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1.1 圆形处理(例)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import cv2 #opencv的缩写为cv2\n",
    "import matplotlib.pyplot as plt # matplotlib库用于绘图展示\n",
    "import numpy as np   # numpy数值计算工具包\n",
    "\n",
    "# 魔法指令，直接展示图，Jupyter notebook特有\n",
    "%matplotlib inline   "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "pie = cv2.imread('01_Picture/06_pie.png') # 读取图像\n",
    "cv2.imshow('img',pie)\n",
    "cv2.waitKey()\n",
    "cv2.destroyAllWindows()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 梯度就是边界点，左边右边不一样\n",
    "def cv_show(img,name):\n",
    "    cv2.imshow(name,img)\n",
    "    cv2.waitKey()\n",
    "    cv2.destroyAllWindows()\n",
    "    \n",
    "# 白到黑是整数，黑到白是负数了，所有的负数会被截断成 0，所以要取绝对值\n",
    "sobelx = cv2.Sobel(pie,cv2.CV_64F,1,0,ksize=3) # 1,0 表示只算水平方向梯度\n",
    "cv_show(sobelx,'sobelx')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "sobelx = cv2.Sobel(pie,cv2.CV_64F,1,0,ksize=3)\n",
    "sobelx = cv2.convertScaleAbs(sobelx) # 取负数时，取绝对值\n",
    "cv_show(sobelx,'sobelx')\n",
    "\n",
    "sobely = cv2.Sobel(pie,cv2.CV_64F,0,1,ksize=3) # 1,0 只算 y 方向梯度\n",
    "sobely = cv2.convertScaleAbs(sobely) # 取负数时，取绝对值\n",
    "cv_show(sobely,'sobely')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 计算 x 和 y 后，再求和\n",
    "sobelxy = cv2.addWeighted(sobelx,0.5,sobely,0.5,0) # 0是偏置项\n",
    "cv_show(sobelxy,'sobelxy')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 不建议直接计算,还有重影\n",
    "sobelxy = cv2.Sobel(pie,cv2.CV_64F,1,1,ksize=3)\n",
    "sobelxy = cv2.convertScaleAbs(sobelxy)\n",
    "cv_show(sobelxy,'sobelxy')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1.2 人照处理(例)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "img = cv2.imread('01_Picture/07_Lena.jpg',cv2.IMREAD_GRAYSCALE)\n",
    "cv_show(img,'img')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "img = cv2.imread('01_Picture/07_Lena.jpg',cv2.IMREAD_GRAYSCALE)\n",
    "sobelx = cv2.Sobel(img,cv2.CV_64F,1,0,ksize=3)\n",
    "sobelx = cv2.convertScaleAbs(sobelx)\n",
    "sobely = cv2.Sobel(img,cv2.CV_64F,0,1,ksize=3)\n",
    "sobely = cv2.convertScaleAbs(sobely)\n",
    "sobelxy = cv2.addWeighted(sobelx,0.5,sobely,0.5,0)\n",
    "cv_show(sobelxy,'sobelxy')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 整体计算有重影和模糊，不建议整体计算\n",
    "img = cv2.imread('01_Picture/07_Lena.jpg',cv2.IMREAD_GRAYSCALE)\n",
    "sobelxy = cv2.Sobel(img,cv2.CV_64F,1,1,ksize=3)\n",
    "sobelxy = cv2.convertScaleAbs(sobelxy)\n",
    "cv_show(sobelxy,'sobelxy')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2. Scharr算子"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "① 对结果的差异更敏感一些。"
   ]
  },
  {
   "attachments": {
    "image.png": {
     "image/png": "iVBORw0KGgoAAAANSUhEUgAAA3YAAACdCAIAAAB3pH0GAAAgAElEQVR4nO3da1BT574/8GdBuAeSEOQaTYAk3MJVFA2ooFYNtopobU97qu0+3eHss2cOzJzpu85+czpn5pz+p1u695wZ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nTKbzQcOHHjrrbeSk5N5PF57ezveVsn6YKr4Jb3NcB/JnouUX4ogCJlMtnHjxurqatyutra2NjY2bt26lboLK0EQycnJIpEID+J2d3cXFhZSEZPL5R44cODIkSNsNptqeEmSHBkZmZ6e9vPzc3d3x2cJb2tv4wyzyclJvKJ8ea+Lw+GIRCJH3fOddky7yrEQZ6lzXk5dPGVmZqa8vPybb74pKytjsVh79+4VCoX3799PS0szGAznz5+/devW66+//tZbb+FVOy99wocPH+KFPkKhMDg4eNZXQ0NDSZLs7u7GA5mNjY0ajWbLli2rvehnORHTy8tr165dFRUVZ8+eNZvNRqPx5s2bmZmZr732GnUivL29qdItFsus0UoulxsREWHdfpEk2dTUVF5ejod2N27cyOPxGhoa+vr6wsLCdu7cKRQKbTnLRqPxzp07arV6ecElNjb20KFDy4uY1Ox7ai8DRrFbbELPd75ECE1OTs57mxl8opaURO3p2a4Y6oJPS34b75+fqqP76Unj+Hc5WsG01LGxsaqqqt7e3oMHD7799tujo6NVVVUBAQFHjhyJj48/efJkTU3Npk2b9uzZY8uzUQt9cnNz33333bmptK+v7+TJk1evXsX/rKurq62t3bRpk936CTMzM7dv3z59+vTjx48PHjz4hz/8gdrr0boGvAv92NhYcnIy/jgvlObnLnwhCCI4ODgoKGhwcHBkZGRkZIQhq/dCQkL27dtXWVmJk/SjR4/u3LmzY8eO2NhY6iX4+flRzRdJkng5AsZisdatWxcREUEdPDU1de/ePbVabTAYZDLZzp07AwICSJLs6uq6ffu2QCDYtm3bSy/V4Sb31q1by3sPSKXSnJyc5d2MA49KmM3msbGxsbExe+1N4SxXOZylznk5QfGjo6NjY2PIqhlfEovF0tHRodFogoOD33rrLYVCcerUqaqqqqSkpI0bN0ZGRp45c6asrGz79u1xcXEvfWPjSTJarVYoFB4/fnzeudG//vrrN998g4cz7bboZzkRE98u4t1339Xr9VVVVWazWavVfvfddwEBAfHx8XNXmE5OTk5NTVk/MmstJEmS9fX1165dM5lM/v7+lZWVZWVlYrHY19e3sbHx4s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e2sx0mSzMnJOXToELR3r5qhoaGzZ8/W19fPepwkybq6OoeUBMCaYTAYLly4oNVq537pwIEDubm50OSC5SFJsqam5vz58yMjI7O+ZDAYurq6HFKVE4GISb+RkZFbt27N+6WIiIhDhw7ZuR7gcARB1NXVffvtt44uBIA1aJEmVyQS5ebm2rkesJZ0d3dfunSps7PT0YU4JYiYdEpISPjnf/7nhXrMJEnGx8fbuSTABCRJJiQkvPfeewsdsGHDBg6HY8+SAFgD4uPjF29yExIS7FwSWGM2bNjw+uuvzx3FxPB7DK6YL4SAU0MXatLGIgfweDyYGPQKGhoaGhoaWuTnTpKkv78/bBQKgO1wkzvvLGcKzMUEKwHvsRWCiAkAAAAAAGjm4ugCAAAAAADAWgMREwAAAAAA0AwiJgAAAAAAoBlETAAAAAAAQDOImAAAAAAAgGYQMQEAAAAAAM0gYgIAAAAAAJpBxAQAAAAAADSDiAkAAAAAAGgGERMAAAAAANAMIiYAAAAAAKAZREwAAAAAAEAziJgAAAAAAIBmEDEBAAAAAADNIGICAAAAAACaQcQEAAAAAAA0g4gJAAAAAABo9v8B3I0drgyi484AAAAASUVORK5CYII="
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![image.png](attachment:image.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3. Laplacian算子"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "① Laplacian算子用的是二阶导，对噪音点更敏感一些。\n",
    "\n",
    "② 如果中心点是边界，它与周围像素点差异的幅度会较大，Laplacian算子根据此特点可以把边界识别出来。"
   ]
  },
  {
   "attachments": {
    "image.png": {
     "image/png": "iVBORw0KGgoAAAANSUhEUgAAATMAAACNCAIAAABUjQq4AAAO6klEQVR4nO3dXUxb5R8H8N/hZbxqXyAbczhKaTtEVraIosWxIVuWQuKGF4vJNqdetHfCjXfMq//dbmB3beIiOm9mMnQJbWTBlwUKwalQps61Y8kCOHRpS1JeOkrP/+JArW1pSyn0Oe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Y6MKh2SKSYJXOKA6ERXOiSTNWuXKmJdRMyMiVTqZVTpkEzmbHxO5uy/YSMxve/vtEwqHZLJnLWb4rbOK2HrVdZH17k2sbzv77RMKh2SyR5Vh7AE1dwa+ukIZ8+lThtFLAmFUBlUOiSTRXqTZW2AcY2NRqPR2NjIqTttRDqDxRSx8gxCZEzp8MlpNulNDgtdajXbbDazTfjco87Q3cvI1wUwLUNKh2SySqU3DfMmcjqFqxkqllaOR6U38bwp3Z0gIhGWLhokk3HiHFZMEHfpMM8EYBGSCcAiJBOARZhnbpXb7Z6amuI4LnSjUqlMV38gvVwul9vtDhsPRBQIBNxud+LtIJlb4vF4vvnmm/Hx8bDtn3/+eVr6A2nncrn6+vomJyfDtvM8b7fbE28HydyS+fn5O3fuRG5HMnctjuPsdvv169e32A6SmSStVnvhwoXIkxbY5Xie12q1Fy9e3GiHgwcPSiSSuO1wPM+ntGO7As/zLpfL4/FstENVVdVO9gfY4XK5XC5XjLdsnuflcrlcLo/dDpIJwCLcNQFgEZIJwCIkE4BFSCYAi5BMABYhmQAsQjIBWPR/fa6/AE5JhOEAAAAASUVORK5CYII="
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![image.png](attachment:image.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 4. 各个算子区别"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "img = cv2.imread('01_Picture/07_Lena.jpg',cv2.IMREAD_GRAYSCALE)\n",
    "cv_show(img,'img')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 不同算子的差异\n",
    "img = cv2.imread('01_Picture/07_Lena.jpg',cv2.IMREAD_GRAYSCALE)\n",
    "sobelx = cv2.Sobel(img,cv2.CV_64F,1,0,ksize=3)\n",
    "sobely = cv2.Sobel(img,cv2.CV_64F,0,1,ksize=3)\n",
    "sobelx = cv2.convertScaleAbs(sobelx)\n",
    "sobely = cv2.convertScaleAbs(sobely)\n",
    "sobelxy = cv2.addWeighted(sobelx,0.5,sobely,0.5,0)   \n",
    "\n",
    "scharrx = cv2.Scharr(img,cv2.CV_64F,1,0)\n",
    "scharry = cv2.Scharr(img,cv2.CV_64F,0,1)\n",
    "scharrx = cv2.convertScaleAbs(scharrx)\n",
    "scharry = cv2.convertScaleAbs(scharry)\n",
    "scharrxy = cv2.addWeighted(scharrx,0.5,scharry,0.5,0)\n",
    "\n",
    "laplacian = cv2.Laplacian(img,cv2.CV_64F) # 没有 x、y，因为是求周围点的比较\n",
    "laplacian = cv2.convertScaleAbs(laplacian)\n",
    "\n",
    "res = np.hstack((sobelxy,scharrxy,laplacian))\n",
    "cv_show(res,'res')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.6.3",
   "language": "python",
   "name": "python3.6.3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "222.2px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
